import Vue from 'vue'
import Router from 'vue-router'


const Login = () => import('../components/Login/Login');
const Home = () => import('../pages/Home/Home')
const SearchAll = () => import('../pages/Home/children/SearchAll')
const Movie = () => import('../pages/Movie/Movie')
const SearchMovie = () => import('../pages/Movie/children/SearchMovie')
const MovieDetail = () => import('../components/MovieDetail/MovieDetail')
const CommentPanel = () => import('../components/MovieDetail/children/CommentPanel')
const Cinema = () => import('../pages/Cinema/Cinema')
const CinemaDetail = () => import('../components/CinemaDetail/CinemaDetail')
const SearchCinema = () => import('../pages/Cinema/children/SearchCinema')
const SelectCinema = () => import('../components/SelectCinema/SelectCinema')
const SelectSeat = () => import('../components/SelectSeat/SelectSeat')
const SubmitOrder = () => import('../components/SubmitOrder/SubmitOrder')
const Pay = () => import('../components/Pay/Pay')
const My = () => import('../pages/My/My')
const MyInfo = () => import('../pages/My/children/MyInfo')
const MyOrder = () => import('../pages/My/children/MyOrder')
const MyMovie = () => import('../pages/My/children/MyMovie')
const ModifyUserName = () => import('../pages/My/children/ModifyUserName')
const ModifyUserSign = () => import('../pages/My/children/ModifyUserSign')

Vue.use(Router);

export default new Router({
  routes: [{
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      meta: {
        showTabBar: true,
      }
    },
    {
      path: '/movie',
      name: 'movie',
      component: Movie,
      meta: {
        showTabBar: true
      }
    },
    {
      path: '/cinema',
      name: 'cinema',
      component: Cinema,
      meta: {
        showTabBar: true
      }
    },
    {
      path: '/my',
      name: 'my',
      component: My,
      meta: {
        showTabBar: true
      }
    },
    {
      path: '/my_info',
      name: 'my_info',
      component: MyInfo
    },
    {
      path: '/my_order',
      name: 'my_order',
      component: MyOrder
    },
    {
      path: '/my_movie',
      name: 'my_movie',
      component: MyMovie
    },
    {
      path: '/modify_username',
      name: 'modify_username',
      component: ModifyUserName
    },
    {
      path: '/modify_usersign',
      name: 'modify_usersign',
      component: ModifyUserSign
    },
    {
      path: '/search_all',
      component: SearchAll
    },
    {
      path: '/search_movie',
      component: SearchMovie
    },
    {
      path: '/movie_detail',
      name: 'movie_detail',
      component: MovieDetail
    },
    {
      path: '/cinema_detail',
      component: CinemaDetail
    },
    {
      path: '/select_cinema',
      component: SelectCinema
    },
    {
      path: '/select_seat',
      component: SelectSeat
    },
    {
      path: '/comment_panel',
      component: CommentPanel
    },
    {
      path: '/search_cinema',
      component: SearchCinema
    },
    {
      path: '/submit_order',
      component: SubmitOrder
    },
    {
      path: '/pay',
      component: Pay
    },
    {
      path: '/login',
      component: Login
    },
  ]
})
//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location)
}
